package com.subsequent.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.subsequent.dto.ConsultationsQueryDTO;
import com.subsequent.pojo.Consultations;
import com.subsequent.service.ConsultationsService;
import com.subsequent.mapper.ConsultationsMapper;
import com.subsequent.vo.ConsultationsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
* @author 不.凌
* @description 针对表【consultations(在线问诊表)】的数据库操作Service实现
* @createDate 2025-05-08 11:50:08
*/
@Service
public class ConsultationsServiceImpl extends ServiceImpl<ConsultationsMapper, Consultations>
    implements ConsultationsService{
    @Autowired
    private ConsultationsMapper consultationsMapper;

    @Override
    public PageInfo<ConsultationsVO> getConsultationsList(ConsultationsQueryDTO consultationsQueryDTO) {
        PageHelper.startPage(consultationsQueryDTO.getPageNum(), consultationsQueryDTO.getPageSize());
        List<ConsultationsVO> list = consultationsMapper.getConsultationsList(consultationsQueryDTO);
        PageInfo<ConsultationsVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ConsultationsVO> getByConsultations(Integer consultationId) {
        List<ConsultationsVO> byConsultations = consultationsMapper.getByConsultations(consultationId);
        return byConsultations;
    }

    @Override
    public int updateFeeInt(ConsultationsVO consultationsVO) {
        consultationsVO.setFee(new BigDecimal(0));
        int i = consultationsMapper.updateFeeInt(consultationsVO);
        return i;
    }
}




